<?php
if (!function_exists('loc_isset'))
  dl('loccache.so');

function check_value()
{
    $res = loc_get('test', 'test');

    echo "<p>value: ".var_export($res, true)."</p>\n";

    if ('test' == $res)
        echo "<p>value is correct</p>\n";
    else
        echo "<p>wrong value</p>\n";
}

if (!loc_isset('test', 'test')) {
    echo "<p>setting...</p>\n";
    loc_set('test', 'test', 'test');

    if (loc_isset('test', 'test')) {
        echo "<p>successfully set</p>\n";
        check_value();
    } else {
        echo "<p>failed to set</p>\n";
    }
} else {
    echo "<p>found!</p>\n";
    check_value();
}
